package com.ykq.order.controller;

import com.alibaba.fastjson.JSON;
import com.ykq.Product;
import com.ykq.order.feign.ProductFeign;
import com.ykq.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Autowired
    private ProductFeign productFeign;


    @GetMapping("createOrder/{pid}")
    public String createOrder(@PathVariable("pid")Integer pid){
        Product product = productFeign.findById(pid);
        return JSON.toJSONString(product);
    }

}
